class Cpanel::ContactsController < Cpanel::BaseController

  def show
    @contact = Contact.language(params[:language]).first
  end

  def edit
    @contact = Contact.find params[:id]
  end

  def update
    @contact = Contact.find params[:id]
    if @contact.update_attributes contact_params
      redirect_to "/cpanel/contacts/show/#{@contact.language}", notice: "updated success"
    else
      flash[:notice] = 'updated failed'
      render 'edit'
    end
  end

  private

  def contact_params
    params.require(:contact).permit(:phone, :fax, :address)
  end


end
